const axios = require('axios');
const fs = require('fs');

axios.get('http://sns-webpic-qc.xhscdn.com/202405071538/4f18feb429b9f16eb820bed2a68d614e/1040g008312g64806mo0048pok31gqtr5bkp7uag!nd_dft_wlteh_webp_3', {
    headers: {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.9',
        'Referrer': 'http://127.0.0.1:5173', // 根据实际情况设置引用来源
        // 其他可能需要的头信息
    },
    responseType: 'arraybuffer' // 将响应数据以二进制数组形式返回
})
    .then(response => {
        // 将响应数据保存到文件中
        fs.writeFileSync('image.jpg', response.data);
        console.log('Image saved successfully.');
    })
    .catch(error => {
        console.error(error); // 处理错误
    });
